import java.util.Stack;

/**
 * Description:
 * Date: 2025-11-10
 * Time: 14:39
 */
public class Test {
    public static void main(String[] args) {
        Stack<Integer> stack = new Stack<>();
        stack.push(1);
        stack.push(2);
        stack.push(3);
        stack.push(4);
        System.out.println(stack);
        System.out.println(stack.size());

        stack.pop();
        System.out.println(stack);//后进先出，删除元素4
        System.out.println(stack.peek());//获取栈顶元素，不删除
        System.out.println(stack);
        System.out.println(stack.empty());

    }
}
